package com.example.home.api

import com.example.net.HttpClientAnnotation
import com.example.net.HttpRetrofitAnnotation
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import javax.inject.Qualifier
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)//单例模式作用域
object HomeHiltModel {
    @Provides
    @Singleton
    fun getHomeApiServerModel(@HttpRetrofitAnnotation retrofit: Retrofit):HomeApiServer{
        //通过Retrofit创建HomeApiServer接口实现类
        return retrofit.create(HomeApiServer::class.java)
    }
}